package com.wzn.mq.component.topic.exchange;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class TopicExchangeSender {
	@Autowired
	private AmqpTemplate rabbitTemplate;

	public void send() {
		String msg1 = "I am topic.message msg=====";
		System.out.println("sender1>>>" + msg1);
		this.rabbitTemplate.convertAndSend("exchange", "topic.message", msg1);

		String msg2 = "I am topic.message msg#####";
		System.out.println("sender2>>>" + msg2);
		this.rabbitTemplate.convertAndSend("exchange", "topic.messages", msg2);
	}
}
